Skip to main content

Internal API

When you're writing a model, there are various HTTP API endpoints made available to you.

File Manager

Fetch File

Method: GET

URL: {env["FILE_MANAGER_URL"]}files/*

Description: Gets a file from the chosen project.

URL Parameters:

(String) `*` Path to the file

Success Response Example:

Buffer with file data.

Create File

Method: POST

URL: {env["FILE_MANAGER_URL"]}files/*

Description: Creates a file in the chosen project.

URL Parameters:

(String) `*` Path to the file

Success Response Example:

OK

List Files

Method: GET

URL: {env["FILE_MANAGER_URL"]}files/*

Description: Gets a list of files from the directory from the chosen project.

URL Parameters:

(String) `*` Path to the directory

Success Response Example:

["someFile.txt", "someFile2.txt"]

Analytics Service

Create Custom Datapoint

Method: POST

URL: {env["FILE_MANAGER_URL"]}customdatapoints

Description: Records a custom datapoint in project's custom datapoints table.

Body Parameters:

(String) `type` The custom datapoint type
(Object) `metadata` The metadata
(String) `stringValue` The stringValue
(String) `floatValue` The floatValue
(String) `integerValue` The integerValue

Success Response Example:

{
"id": 55,
"createdAt": "2019-10-18T03:02:00.743Z",
"updatedAt": "2019-10-18T03:02:00.743Z",
"projectId": "s73h3ksa",
"type": "responsetime",
"integerValue": 5950
}

Scenarios

Create Scenario

Method: POST

URL: {env["CREATE_SCENARIO_URL"]}

Description: Creates a scenario for the chosen project.

Body Parameters:

(String) `projectId` The project ID
(String) `appVersion` The app version
(String) `name` Project name
(String) `color`
(String) `scenarioType`
(Object) `scenarioInputs`
(Object) `scenarioMeta`
(Object) `scenarioOutputs`
(Object) `metadata`
(Array) `tags`

Success Response Example:

{
"scenarioId": "fsdgsdgdg"
}

Fetch Scenario Group View

Method: GET

URL: {env["SCENARIO_GROUP_VIEW_URL"]}

Description: Get scenario group view.

Query Parameters:

(String) `p` Path

Success Response Example:

{
"data": {
"breadcrumb": [
{
"resType": "scenariogroup",
"resName": "wqkxuu40s7w1",
"desc": null
}
],
"scenarios": [
{
"key": "yofsazjg",
"value": {
"date": "2022-02-06T13:18:17.099Z",
"desc": "Scenario 1",
"type": "scenarioType1",
"color": "#000",
"isSuper": false,
"createdAt": "2022-02-06T13:18:17.099Z",
"createdBy": "G",
"updatedAt": "2022-02-06T13:18:17.099Z",
"updatedBy": "G",
"appVersion": "alpha",
"createdById": "9fc57e66-fe78-4501-9ca3-a4ec4b327700",
"updatedById": "9fc57e66-fe78-4501-9ca3-a4ec4b327700"
}
},
{
"key": "n86xgqtl",
"value": {
"date": "2022-02-06T14:35:10.043Z",
"desc": "Beta Scenario",
"type": "scenarioType1",
"color": "#000",
"isSuper": false,
"createdAt": "2022-02-06T14:35:10.043Z",
"createdBy": "G",
"updatedAt": "2022-02-06T14:35:10.044Z",
"updatedBy": "G",
"appVersion": "beta",
"createdById": "9fc57e66-fe78-4501-9ca3-a4ec4b327700",
"updatedById": "9fc57e66-fe78-4501-9ca3-a4ec4b327700"
}
},
{
"key": "xfnascf2",
"value": {
"date": "2022-02-16T06:42:17.748Z",
"desc": "GAMMA SCENARIO",
"type": "scenarioType1",
"color": "#000",
"isSuper": false,
"createdAt": "2022-02-16T06:42:17.748Z",
"createdBy": "G",
"updatedAt": "2022-02-16T06:42:17.749Z",
"updatedBy": "G",
"appVersion": "1.0.0",
"createdById": "9fc57e66-fe78-4501-9ca3-a4ec4b327700",
"updatedById": "9fc57e66-fe78-4501-9ca3-a4ec4b327700"
}
}
],
"groups": [
{
"key": "wqkxuu40s7w1",
"value": {}
}
],
"children": [
{
"resType": "scenario",
"resName": "yofsazjg"
},
{
"resType": "scenario",
"resName": "n86xgqtl"
},
{
"resType": "scenario",
"resName": "xfnascf2"
}
]
},
"meta": {
"lineage": true,
"allVersionGroups": {
"pw1mqwa2": {
"appVersion": "alpha",
"lineageEnvironment": "alpha"
},
"zr5n24l3": {
"appVersion": "beta",
"lineageEnvironment": "beta"
},
"ivwr0jr0": {
"appVersion": "1.0.0",
"lineageEnvironment": "gamma"
}
}
},
"hash": "hRzwStgAMtCnsQk5feA9oQ=="
}

App Permissions

Fetch App Permissions For User

Method: GET

URL: {env["PROJECT_PERMISSIONS_URL"]}:email

Description: Fetch app permissions for user.

URL Parameters:

(String) `email` User email

Success Response Example:

[
{
"category_value": "Special Roles",
"permission_value": "Uploader",
"hasListFilesCapability": true,
"listFilesCapabilityPrefix": "uploads/",
"hasFetchFilesCapability": true,
"fetchFilesCapabilityPrefix": "uploads/",
"hasUploadFilesCapability": true,
"uploadFilesCapabilityPrefix": "uploads/"
}
]